package com.appkubes.mall.restful.application.demo;

import com.appkubes.common.Response;
import com.appkubes.mall.restful.event.demo.DemoEvent;
import com.appkubes.mall.restful.event.event.EventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: Rongjie
 * @Date: 2020/3/6
 * @Description:
 */

@RestController
@RequestMapping("/demo")
@Slf4j
public class DemoController {
    @Resource
    EventService eventService;

    @GetMapping("/event")
    public Response event() {
        log.info("event");
        DemoEvent event = new DemoEvent("demo");
        eventService.publishEvent(event);
        return Response.success("test");
    }
}
